import time
import unittest
from page.home_page_lcy import Home_Page
import selenium


class SearchTestcase(unittest.TestCase):
    @classmethod
    def setUpClass(cls) -> None:
        cls.home = Home_Page(appPackage='com.nearme.gamecenter', appActivity='.ui.activity.SplashActivity')

    def test_01_search(self):
        self.home.search_button_click()
        self.home.search_box_input('原神')
        time.sleep(3)
        self.home.search_click()
        time.sleep(2)
        text1 = self.home.get_search_content_text()
        self.home.search_content_click()
        text2 = self.home.get_app_name()
        self.assertEqual(text1, text2, msg='断言搜索成功')

    @classmethod
    def tearDownClass(cls) -> None:
        cls.home.quit()


if __name__ == '__main__':
    unittest.main(verbosity=2)
